package cn.saddyfire.pattern.command;

import com.sun.org.apache.xpath.internal.SourceTree;

/**
 * @author Dee
 * @date 2024/2/15
 * <p>Description:具体命令类
 */
public class OrderCommand implements Command {
    //持有接收者对象
    private SeniorChef receiver;
    private Order order;

    public OrderCommand(SeniorChef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }

    /**
     * 执行命令
     */
    @Override
    public void execute() {
        System.out.println(order.getDiningTable() + "桌的订单：");
        order.getFoodDir()
                .forEach((k, v) -> receiver.makeFood(v, k));
        System.out.println(order.getDiningTable() + "桌的订单已完成");
    }
}
